//头部的搜索框的js
let wind=window.location

if(document.body.dataset.id!=1){
    for(let i=1;i<=8;i++){
        if(document.body.dataset.id==i){
            if(localStorage.getItem(`on${i}`)==0){
                localStorage.setItem(`on${i}`,"1")
                location.reload()
               
            }
        }
    }
   
}

     
//********************固定栏


let ifr2 = document.querySelector("#ifr2")
let ifr1 = document.querySelector("#ifr1")
ifr2.addEventListener('load', function(){
     // window.pageYOffset
   let shang = ifr2.contentWindow.document.body.querySelector(".shang")

   shang.addEventListener("click", () => {
       // window.pageYOffset=0
       // 跳回顶部
       window.scrollTo({
           top: 0,
           behavior: 'smooth'
       })

   })
   // 滚路你往下划100px的时候出现跳转按钮
   document.addEventListener("scroll", () => {
       if (window.pageYOffset > 100) {
         
           shang.style.display = "block"
       } else {
           shang.style.display = "none"
       }
   })
})



ifr1.addEventListener('load', function(){


    
  
   
    // 跳转页面
let tz=ifr1.contentWindow.document.body
tz.querySelector(".two1").addEventListener("click",()=>{
    window.location.href="../郁坤/index.html"
   })
   tz.querySelector(".two2").addEventListener("click",()=>{
    window.location.href="../郝云奇/list.html"
   })
   tz.querySelector(".two3").addEventListener("click",()=>{
    window.location.href="../新碟/内地.html"
   })
   tz.querySelector(".two4").addEventListener("click",()=>{
    window.location.href="../刘闯/排行榜.html"
   })
   tz.querySelector(".two5").addEventListener("click",()=>{
    window.location.href="../曹志贤/list.html"
   })
   tz.querySelector(".two6").addEventListener("click",()=>{
    window.location.href="../杨世辉/index.html"
   })
   tz.querySelector(".two8").addEventListener("click",()=>{
    window.location.href="../仝善原/list.html"
   })
   tz.querySelector(".two7").addEventListener("click",()=>{
    window.location.href="../宋宜鸣/MV.html"
   })
 tz.querySelector(".login").addEventListener("click",()=>{
    window.location.href="../郝云奇/register.html"
})
 tz.querySelector(".logins").addEventListener("click",()=>{
    window.location.href="../郝云奇/denglu.html"
})
tz.querySelector(".one1").addEventListener("click",()=>{
    window.location.href="../郁坤/index.html"
   })
   tz.querySelector(".one2").addEventListener("click",()=>{
    window.location.href="../代普/mymusic.html"
   })
   tz.querySelector(".one3").addEventListener("click",()=>{
    window.location.href="../代普/download.html"
   })
   tz.querySelector(".one4").addEventListener("click",()=>{
    window.location.href="../郝云奇/artists.html"
   })
   tz.querySelector(".one5").addEventListener("click",()=>{
    window.location.href="../vip/vip.html"
   })
  
//头部导航栏
let lisi=tz.querySelector(".lisi")
let ipt=tz.querySelector(".ipt")
ipt.addEventListener("focus",()=>{
    lisi.style.display="flex"
})
ipt.addEventListener("blur",()=>{
    lisi.style.display="none"
})

let nav=tz.querySelectorAll(".nav")

// console.log("达到",document.body.dataset.id);

   if(document.cookie==9){
    nav[1].classList.add("active")
    nav[0].classList.remove("active")
   }else{
    nav[0].classList.add("active")
    nav[1].classList.remove("active")
   }
   let two= tz.querySelectorAll(".nav-list>li>a")

   for(let i=0;i<two.length;i++){
    if(document.body.dataset.id==i+1)
    two[i].style.color="#31c27c"
        

   
   }
   


  
})








      

